/*
 *  $Id: Meditation.cs 975 2009-12-16 17:13:22Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima {
    /// <summary>
    /// Условие на медитацию: игрок не должен в этот ход тратить ману
    /// </summary>
    public class CanMeditationCondition: Condition {
        public CanMeditationCondition() {}

        public override bool Test(AbstractObject caster, Card card) {
            return !caster.Owner.HasDecrementMana;
        }

        private static readonly Languages.Phrase Already = new Languages.Phrase("condition.meditation.can");

        public override Languages.Phrase Notice {
            get { return Already; }
        }
    }

    public class MeditationCondition: Condition {
        public readonly int Value;
        public readonly bool Decrease;

        public MeditationCondition(int value, bool decrease) {
            Value = value;
            Decrease = decrease;
        }

        public override bool Test(AbstractObject caster, Card card) {
            return caster.Owner.Meditation >= Value;
        }

        public override void DoCondition(AbstractObject caster, Card card) {
            if (Decrease) caster.Owner.DecMeditation(Value);
        }

        public static readonly Languages.Phrase NotEnough = new Languages.Phrase("condition.meditation.not_enough");

        public override Languages.Phrase Notice {
            get { return NotEnough; }
        }

        public override int GetWeight(Card card) {
            return Value * WeightCoeff.Meditation;
        }
    }
}